from django.contrib import admin
from .models import *
from configureCenter.models import *
from django.shortcuts import render,HttpResponse

# Register your models here.
class ArticleAdmin(admin.ModelAdmin):
    def changelist_view(self, request, extra_context=None):
        print ("========11",request.method)
        if request.method == "POST":
                select_task=request.POST.get("select_task")
                select_action=request.POST.get("select_action")
                print (select_task,select_action)

        project={}
        for d in Project.objects.all():
           ds=[]
           for a in d.temp.pipeline.all() :
                v={}
                v["name"]=a.name
                v["id"]=a.id
                ds.append(v)

           project[d.name]=ds
           
        print (project)
        return render(request, 'admin/taskExec.html', {
            "project": project
        })

        


# admin.site.disable_action('delete_selected')

admin.site.register(TaskExec,ArticleAdmin)

admin.site.register(Task)